<template>
    <el-dialog   :modelValue="dialogVisible"  title="关于..."  width="40%"
                      :close-on-click-modal="false" :close-on-press-escape="false"
                      :show-close="false" >
        <el-card   shadow="always">
          <div :style="authStyle">{{authorize}}</div>
          <div style="font-size: 18px; margin-top: 20px">前端版本{{packetData.version}}</div>
          <div style="font-size: 18px; margin-top: 20px">后端版本{{versionback}}</div>
        </el-card>

        <template #footer>
          <el-button type="primary" @click="handleClose">关闭</el-button>
        </template>

    </el-dialog>
</template>

<script>
import request from "@/utils/drawutils/request";
const  packetData = require('../../../package.json')

export default {
  name: "DlgAbout",
  props:{ dialogVisible: Boolean},
  components: {
  },
  emits:[ "resAbout" ],
  computed:{
    authorize :function ( ){
      if (this.authRes === -1)
        return "系统未授权使用"
      else if (this.authRes === 0)
        return "系统已授权使用"
      else if (this.authRes === 9)
        return "系统永久授权使用"
      else
        return "未知"
    },
    authStyle: function (){
      if (this.authRes === -1)
        return "color : red; font-size: 14px"
      else if (this.authRes === 0)
        return 'color : green'
      else if (this.authRes === 9)
        return 'color : green'
      else
        return ""
    },
  },
  mounted() {
    request.post("/sysauthorize/getauthres", { }).then(res => {
      // console.log(res)
      this.authRes = res.data
      this.versionback = res.jsonMsg.version
      //this.authRes = -1
      this.$store.commit( 'setAuthRes', this.authRes )

    })
  },
  data(){
    return {
      authRes : 0,
      versionback:  "1.000",
      packetData: packetData,

    }
  },
  methods:{
    handleClose(  ){
      this.$emit( "resAbout", 0 )
    },
  }
}
</script>

<style scoped>
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

/* .box-card {
  width: 480px;
  height: 400px;
} */

</style>